use thiserror::Error;

#[derive(Debug, Error)]
pub enum MockProxyError {
    #[error("METHOD_NOT_ALLOWED {0}")]
    MethodNotAllowed(String),
    #[error("Not_FOUND {0}")]
    NotFound(String),
}

#[derive(Debug, Error)]
pub enum AdminOpError {
    #[error("RecordNotExist {0}")]
    RecordNotExist(String),
    #[error("RecordExist {0}")]
    RecordExist(String),
    #[error("InvalidParam {0}")]
    InvalidParam(String),
    #[error("InvalidParam {0}")]
    InternalError(String),
    #[error("AuthNotAllowed {0}")]
    AuthNotAllowed(String),
}

impl From<sqlx::Error> for AdminOpError {
    fn from(err: sqlx::Error) -> Self {
        AdminOpError::InternalError(err.to_string())
    }
}

#[derive(Debug, Error)]
pub enum RuntimeError {
    #[error("config {0} file not found")]
    InvalidConfParam(String),
    #[error("InternalError {0}")]
    InternalError(String),
}
